package com.android.ailaoshan.index.config;

import android.content.Context;
import android.view.View;

import com.android.ailaoshan.R;
import com.qmuiteam.qmui.widget.QMUILoadingView;


/**
 * 展示正在加载的视图
 */
class QMUILoading {
    private QMUILoadingView loadingView;
    private Context mContext;

    QMUILoading(QMUILoadingView loadingView,Context context) {
        this.loadingView = loadingView;
        this.mContext = context;
    }

    /**
     * 显示正在加载
     */
    void startLoading(){
        if(loadingView != null){
            loadingView.setVisibility(View.VISIBLE);
            loadingView.setColor(R.color.loading_color);
            loadingView.setBackgroundColor(mContext.getResources().getColor(R.color.qmui_s_transparent));
            loadingView.setActivated(true);
            loadingView.setSize(100);
            loadingView.start();
        }
    }

    /**
     * 停止加载
     */
    void stopLoading(){
        if(loadingView != null){
            loadingView.setActivated(false);
            loadingView.stop();
            loadingView.setVisibility(View.INVISIBLE);
        }
    }
}
